// @algorithm @lc id=100331 lang=cpp
// @title que-shi-de-shu-zi-lcof

#include "algm/algm.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
    int missingNumber(vector<int> &nums) {
        int n = nums.size();
        int left = 0, right = n - 1;
        int mid;
        while (left <= right) {
            mid = left + (right - left) / 2;
            if (nums[mid] == mid) {
                left = mid + 1;
            }
            else {
                right = mid - 1;
            }
        }
        return left;
    }
};